<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<link rel="stylesheet" href="${BASE_PATH}/static/plugins/kindEditor/themes/default/default.css" />
<link rel="stylesheet" href="${BASE_PATH}/static/plugins/kindEditor/plugins/code/prettify.css" />
<script type="text/javascript" src="${BASE_PATH}/static/plugins/kindEditor/kindeditor.js"></script>
<script type="text/javascript" src="${BASE_PATH}/static/plugins/kindEditor/lang/zh_CN.js"></script>
<script type="text/javascript" src="${BASE_PATH}/static/plugins/kindEditor/plugins/code/prettify.js"></script>
	<style type="text/css">

		.toker ul{
			float: left;
    		margin-left: -46px;
			
		}
		.toker ul li{
			float:left;
			list-style:none;
			display:inline;
			
		}
		.toker ul li span{
    		margin-left: 8px;
    		margin-right: 10px;

		}
		
		.toker ul li input{
		   border-radius: 1px;
		    color: inherit;
		    padding: 0px 8px;
		    font-size: 14px;
		}
	
	
		
	</style>
<script type="text/javascript">
$(function(){
	//初始化表单验证
	$("#addForm").validate({
		rules: {
			onePoint: {isMoney: true},
			oneDetion:{isMoney: true},
			oneDcount:{isMoney: true},
			twoPoint:{isMoney: true},
			twoDetion: {isMoney: true},
			twoDcount: {isMoney: true},
			twoPoint:{isMoney: true},
			twoDetion: {isMoney: true},
			twoDcount: {isMoney: true},
			threePoint:{isMoney: true},
			threeDetion: {isMoney: true},
			threeDcount: {isMoney: true},
			fourPoint:{isMoney: true},
			fourDetion: {isMoney: true},
			fourDcount: {isMoney: true},
			fivePoint:{isMoney: true},
			fiveDetion: {isMoney: true},
			fiveDcount: {isMoney: true},
		},
		messages: {
			onePoint: {required: "1级积分值错误"},
			oneDetion:{required: "1级抵扣券错误"},
			oneDcount:{required: "1级惠券错误"},
			twoPoint:{required: "2级积分值错误"},
			twoDetion: {required: "2级抵扣券错误"},
			twoDcount: {required: "2级惠券错误"},
			threePoint:{required: "营业部服务积分值错误"},
			threeDetion: {required: "营业部服务抵扣券错误"},
			threeDcount: {required: "营业部服务惠券错误"},
			fourPoint:{required: "分公司培训积分值错误"},
			fourDetion: {required: "分公司培训抵扣券错误"},
			fourDcount: {required: "分公司培训惠券错误"},
			fivePoint:{required: "公司管理积分值错误"},
			fiveDetion: {required: "公司管理抵扣券错误"},
			fiveDcount: {required: "公司管理惠券错误"},
		},
		submitHandler:function(form){
			$(form).ajaxSubmit({
				success:function(data){
					switch(data.flag){
					case 1:
						Kit.alert("关闭拓客成功！");
						query(-1);
						tokerDialog.close();
						return;
					case -1:
						Kit.alert(data.message);return;
					case 0:
						dataPaginator.loadPage(1);
						query(-1);
						tokerDialog.close();
						return;
					}
				}
			});
		}
	});
	$(".iCheckList").on("click","#openRebate",function(){
		console.log(1);
	})
	
});
function doRebate(obj){
	alert();
	console.log(obj.is(":checked"));
}
</script>
<form id="addForm" action="${BASE_PATH}/bus/goods/base/doToker" method="post" class="form-horizontal">
	<div class="form-group">
	    <label class="col-lg-2 control-label">商品名称</label>
	    <div class="col-lg-9">
	    <input type="hidden" name="goodsId"  value="${goods.id}">
        	<input type="text" name="name" class="form-control" style="border-radius: 2px; padding: 2px 8px;height: 36px;" value="${goods.name}" disabled="disabled" maxlength="100">
	    </div>
	</div>


	<div class="form-group" id="general2">
	    <label class="col-lg-2 control-label">是否分销</label>
	    <div class="col-lg-9">
	    	<select id="openRebate" name="openRebate" class="selectpicker form-control" required data-width="120">
	    		<option id="op2"  <c:if test="${toker.state==0 }"> selected="selected" </c:if> value="0">关闭分销</option>
	    		<option id="op1"  <c:if test="${toker.state==1 }"> selected="selected" </c:if> value="1">开启分销</option>
	    		
	    	</select>
	    	<input type="hidden" id="state" name="state"   value="1" >
	    </div>
	</div>	
	<div class="form-group" id="rebateLv1"   <c:if test="${toker.state==0 }">style="display:none;"</c:if> >
	    <label class="col-lg-2 control-label">一级返利</label>
	    <div class="col-lg-9 toker">
        	<ul>
				<li>
					<span >积分值 </span>
					<input type="number" name="onePoint" id="onePoint" size="12" class=" width100"  placeholder="请输入数字" value="${toker.onePoint}" />
				</li>
				<li>
					<span>抵扣券 </span> 
					<input type="number" name="oneDetion" id="oneDetion" size="12"  placeholder="请输入数字"  class=" width100" value="${toker.oneDetion}"/></li>
				<li>
					<span>惠券 </span>  
					<input type="number" name="oneDcount" id="oneDcount" size="12" placeholder="请输入数字"  class=" width100" value="${toker.oneDcount}"/>
				</li>
			</ul>
	    </div>
	</div>

	<div class="form-group" id="rebateLv2" <c:if test="${toker.state==0 }">style="display:none;"</c:if> >
	    <label class="col-lg-2 control-label">二级返利</label>
	    <div class="col-lg-9 toker">
			<ul>
				<li>
					<span >积分值 </span>
					<input type="number" name="twoPoint" id="twoPoint" size="12" class=" width100"  placeholder="请输入数字" value="${toker.twoPoint}" />
				</li>
				<li>
					<span>抵扣券 </span> 
					<input type="number" name="twoDetion" id="twoDetion" size="12"  placeholder="请输入数字"  class=" width100" value="${toker.twoDetion}"/></li>
				<li>
					<span>惠券 </span>  
					<input type="number" name="twoDcount" id="twoDcount" size="12" placeholder="请输入数字"  class=" width100" value="${toker.twoDcount}"/>
				</li>
			</ul>
	    </div>
	</div>
	
		<div class="form-group" id="rebateLv3" <c:if test="${toker.state==0 }">style="display:none;"</c:if> >
	    <label class="col-lg-2 control-label">营业部服务奖励</label>
	    <div class="col-lg-9 toker">
			<ul>
				<li>
					<span >积分值 </span>
					<input type="number" name="threePoint" id="threePoint" size="12" class=" width100"  placeholder="请输入数字" value="${toker.threePoint}" />
				</li>
				<li>
					<span>抵扣券 </span> 
					<input type="number" name="threeDetion" id="threeDetion" size="12"  placeholder="请输入数字"  class=" width100" value="${toker.threeDetion}"/></li>
				<li>
					<span>惠券 </span>  
					<input type="number" name="threeDcount" id="threeDcount" size="12" placeholder="请输入数字"  class=" width100" value="${toker.threeDcount}"/>
				</li>
			</ul>
	    </div>
	</div>
	
	<div class="form-group" id="rebateLv4" <c:if test="${toker.state==0 }">style="display:none;"</c:if> >
	    <label class="col-lg-2 control-label">分公司培训奖励</label>
	    <div class="col-lg-9 toker">
			<ul>
				<li>
					<span >积分值 </span>
					<input type="number" name="fourPoint" id="fourPoint" size="12" class=" width100"  placeholder="请输入数字" value="${toker.fourPoint}" />
				</li>
				<li>
					<span>抵扣券 </span> 
					<input type="number" name="fourDetion" id="fourDetion" size="12"  placeholder="请输入数字"  class=" width100" value="${toker.fourDetion}"/></li>
				<li>
					<span>惠券 </span>  
					<input type="number" name="fourDcount" id="fourDcount" size="12" placeholder="请输入数字"  class=" width100" value="${toker.fourDcount}"/>
				</li>
			</ul>
	    </div>
	</div>
	
	<div class="form-group" id="rebateLv5" <c:if test="${toker.state==0 }">style="display:none;"</c:if> >
	    <label class="col-lg-2 control-label">公司管理奖励</label>
	    <div class="col-lg-9 toker">
			<ul>
				<li>
					<span >积分值 </span>
					<input type="number" name="fivePoint" id="fivePoint" size="12" class=" width100"  placeholder="请输入数字" value="${toker.fivePoint}" />
				</li>
				<li>
					<span>抵扣券 </span> 
					<input type="number" name="fiveDetion" id="fiveDetion" size="12"  placeholder="请输入数字"  class=" width100" value="${toker.fiveDetion}"/></li>
				<li>
					<span>惠券 </span>  
					<input type="number" name="fiveDcount" id="fiveDcount" size="12" placeholder="请输入数字"  class=" width100" value="${toker.fiveDcount}"/>
				</li>
			</ul>
	    </div>
	</div>

	<div class="row">
		<div class="col-lg-6"><button class="btn btn-primary col-sm-3 pull-right" type="submit" autocomplete="off">提交</button></div>
		<div class="col-lg-6"><button class="btn btn-default col-sm-3 pull-left"  type="button" onclick="javascript:tokerDialog.close();" autocomplete="off">取消</button></div>
	</div>
</form>

<script type="text/javascript">
$(function(){
/* 	$("#onePoint").val(0);
	$("#oneDetion").val(0); 
	$("#oneDcount").val(0); 
	$("#onePoint").val(0);
	$("#twoPoint").val(0); 
	$("#twoDcount").val(0);  */
	
	$("#openRebate").change(function(){
		var flag = $("#openRebate option:selected").val();
		console.log("flag>>>",flag);
		$("#state").val(flag); 
		if(flag == '1'){
			$("#rebateLv1").show();
			$("#rebateLv2").show();
			$("#rebateLv3").show();
			$("#rebateLv4").show();
			$("#rebateLv5").show();
		}
		if(flag == '0'){
			$("#rebateLv1").hide();
			$("#rebateLv2").hide();
			$("#rebateLv3").hide();
			$("#rebateLv4").hide();
			$("#rebateLv5").hide();
			
	
		}
	});
});


</script>